﻿namespace FML

#light
     

module OptionT =

 printf "option trans test\n\n"
 module List = 

  open OptionT.List

  open  Microsoft.FSharp.Control
  open  Microsoft.FSharp.Control.LazyExtensions
  open FsCheck

  let (>>=) m f = optionListT.Bind (m, f)
  let ret = optionListT.Return
 
  quickCheck (fun  f a -> ((ret a) >>= f) = f a)
  quickCheck (fun m  -> (m >>= ret) = m)
  quickCheck (fun m f g-> ((m >>= f) >>= g) = (m >>= (fun x -> f x >>= g)))


 module State =

  open OptionT.State
  open FML.StateM

  open  Microsoft.FSharp.Control
  open  Microsoft.FSharp.Control.LazyExtensions
  open FsCheck

  let (>>=) m f = optionStateT.Bind (m, f)
  let ret = optionStateT.Return
 
  quickCheck (fun f a s-> run ((ret a) >>= f) s = run (f a) s)
  quickCheck (fun m s -> run (m >>= ret) s = run m s)
  quickCheck (fun m f g s ->run  ((m >>= f) >>= g) s = run (m >>= (fun x -> f x >>= g)) s)

  




